<template>
<div class="page">
    <div class="layui-fluid">      
      <div class="layui-card-body">							
	  <div class="layui-form" lay-filter=""> 
	  	<div class="layui-form-item">
			<div class="layui-inline">
			    <label class="layui-form-label">订单号</label>
			    <div class="layui-input-inline" >
			        <input type="text" name="" disabled="disabled" v-model="itemData.orderSerialno" placeholder="" autocomplete="off" class="layui-input" maxlength="">
			    </div>										   
		  </div>
		</div>
      	<div class="layui-form-item">
      		<label class="layui-form-label">商品图片</label>
		    <div class="layui-input-inline">
		        <div class="layui-upload">										
				  <div class="layui-upload-list">				  
				   	 <img class="layui-upload-img" :src="itemData.project.logo?itemData.project.logo:'http://kedoujfpc.tongdui365.com/static/common/image/zwyl.jpg'" width="100" height="100" style="border:1px solid #eee;">
				  </div>
				</div>
		    </div>		       
		</div>	
		<div class="layui-form-item">
		    <label class="layui-form-label">商品名称</label>
		    <div class="layui-input-inline">
		      <input type="text"  disabled="disabled"  v-model="itemData.project.name"  lay-verify="required" placeholder="" autocomplete="off" class="layui-input a" maxlength="" >
		    </div>		   
		</div>
		<div class="layui-form-item">
			<div class="layui-inline">
			    <label class="layui-form-label">价格</label>
			    <div class="layui-input-inline" >
			        <input type="number" name="" disabled="disabled" v-model="itemData.totalAmount/100" placeholder=""   autocomplete="off" class="layui-input" maxlength="">
			    </div>										   
		  </div>
		</div>		
		
		<div class="layui-form-item">
		    <label class="layui-form-label">会员</label>
		    <div class="layui-input-inline">
		      <input type="text"  disabled="disabled"  v-model="itemData.usersName.accountName" lay-verify="required" placeholder="" autocomplete="off" class="layui-input a">
		    </div>		 
		</div>		
		<div class="layui-form-item">
		    <label class="layui-form-label">状态</label>
		    <div class="layui-input-inline">
		      <input type="text"  disabled="disabled"  v-model="verifyStatus" lay-verify="required" placeholder="" autocomplete="off" class="layui-input a" >
		    </div>		    
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">付款时间</label>
		    <div class="layui-input-inline">
		      <input type="text"  disabled="disabled"  v-model="time" lay-verify="required" placeholder="" autocomplete="off" class="layui-input a" >
		    </div>		    
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">付款方式</label>
		    <div class="layui-input-inline">
		      <input type="text" v-model="channelId" lay-verify="required" placeholder="" autocomplete="off" class="layui-input a" >
		    </div>		    
		</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">实付金额</label>
		    <div class="layui-input-inline">
		      <input type="text"  disabled="disabled"  v-model="itemData.payAmount/100" lay-verify="required" placeholder="" autocomplete="off" class="layui-input a" >
		    </div>		    
		</div>
		
		<div class="layui-form-item" v-if="itemData.status!='CANCEL'">
		    <div class="layui-input-block">		    	
		      <button class="layui-btn" @click="verifyCode()" style="display:none" v-if="itemData.verifyStatus=='VERIFY_SUCCESS'"  lay-submit lay-filter="formDemo">验证</button>
		      <button class="layui-btn" @click="verifyCode()" style="display:block" v-else="itemData.verifyStatus=='VERIFY_SUCCESS'"  lay-submit lay-filter="formDemo">验证</button>
		    </div>
		</div>
      	 <!--// -->      
      </div>
      </div>
    </div>
</div>
</template>
<script>
	import Tables from '../common/tables.vue'
	import Search from '../common/search.vue'
	export default {
	  name: 'xfdetail',
	  components: {Tables,Search},
	  data () {
	    return {	    	
	    	time:'',
	    	channelId:'',
	    	verifyStatus:'',	    	
	    	itemData:{project:{},usersName:{}},//回选   :
	    }
	  },
	  mounted(){
	  	 var _this = this;   	
	     window.getdates = this.getdates;    	
	  },
	  methods: {
		getdates:function(data){		
			var _this = this; 			
			_this.id=data.id;					
			var url="/verify/bapi/v1.9/consumption-order/consumption/"+_this.id						
			ajaxRequest(url,'GET','json','',function(ret,err){
				//alert(url+"///"+JSON.stringify(ret))
				_this.itemData=ret.data;				
				_this.time=FormatDate(ret.data.createAt,3);
				if(ret.data.payDetail.channelId=='-1'||ret.data.payDetail.channelId=='10'){
					_this.channelId='余额支付';
				}else if(ret.data.payDetail.channelId=='112'){
					_this.channelId='支付宝app支付';
				}else if(ret.data.payDetail.channelId=='123'){
			        _this.channelId='微信app支付';
				}else if(ret.data.payDetail.channelId=='125'){
					_this.channelId='微信小程序支付';
				}
				else if(ret.data.payDetail.channelId=='12'){
					_this.channelId='UC支付';
				}
				else if(ret.data.payDetail.channelId=='13'){
					_this.channelId='WUC支付';
				}
				if(ret.data.verifyStatus=='UNVERIFIED'){
					_this.verifyStatus='未验证'
				}else if(ret.data.verifyStatus=='VERIFY_SUCCESS'){
					_this.verifyStatus='验证成功'	
				}else{
					_this.verifyStatus='取消'	
				}				
			})			
	   },	
	   verifyCode:function(){
   	       var _this=this;
		   var datas={
			 verifyCode:_this.itemData.verifyCode,
		   }
		   var url="/verify/bapi/v1.9/consumption-order/useVerifyCode"
	       ajaxRequest(url,'PUT','json',datas,function(ret,err){
	    	  layer.msg('验码成功');
	    	  var is=_this.isclick;
	    	  setTimeout(function(){
			  	 _this.getdates();
	          },1000)	    	
	       })	   	
    },
		screens:function(){
			return screen();
		},
    },
	updated:function(){
	  	this.isShow = true;
		layui.use('form', function(){
		  var form = layui.form;
		  form.render();
		});
	},
}
</script>
<style scoped>
/**/
</style>
